home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Need info on __far and __huge macros in Microsoft C please!
- From: ufo@sbbs.se (Urban Fosseus)
- X-Newsreader: WinVN 0.99.7
- References: <4cqcjr$k85@cloner3.netcom.com>
- MIME-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- NNTP-Posting-Host: ppp11.sbbs.se
- Message-ID: <30f1c935.0@news.sbbs.se>
- Date: 9 Jan 96 01:47:33 GMT
- Path: news.sbbs.se!
-
- In article <4cqcjr$k85@cloner3.netcom.com>, travisp@ix.netcom.com (Gerald
- Phillips) says...
- >
- >I am attempting to convert some code from Microsoft C to TC++. If
- >someone could give me some specs. on the "__far" and "__huge" macros
- >from MSC I would appreciate it.
- >
- >gtp
- >
-
- NEAR , FAR and HUGE are macros that expand to __far and __huge when compiling
- for MSDOS or Win16
-
- __near , __far and __huge are directives that tell the compiler what sort of
- pointer it is.
-
- A __far pointer can point at any <= 64 kB block in any _one_ 16-bit segment.
- This is the "classic" x86 pointer.
- A __near pointer points into the default data segment, which _totals_
- <= 64 kB, but there is a lot of other stuff there to begin with, so it
- is of very limited use as dynamic heap for any "serious" program.
- A __huge pointer is a pointer into a consequtive sequence of 16-bit
- segments that act as one > 64 kB block, typically an array of < 64 kB structs
- or objects but with "too many" elements. There is quite a lot of code
- generated for each dereference of a __huge pointer.
-
- A compiler-switch tells which type of pointer that is the default. For
- hysterical resons many old Windows apps are compiled with the "Medium"
- memory model, i.e. using __near pointers as default, and then having
- explicit _far on practicly everything in the code.
-
- If You are porting to Win32, just delete everything, and you will be fine.
- If you port to another Win16 or MS-DOS environment, find the equivalents
- for your new compiler, I'm sure they're there somewhere.
-
- // Urban
-
-